package phoenix.web.test_suites.adsbridge;

import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import phoenix.core.base.TestSuiteBase;
import phoenix.core.data_models.UserProfileDataModel.AboutMe;
import phoenix.core.data_models.UserProfileDataModel.LookingFor;
import phoenix.core.data_models.UserProfileDataModel.PaymentDetails;
import phoenix.web.test_objects.BackendTests;
import phoenix.web.test_objects.FunnelTests;
import phoenix.web.test_objects.RegistrationTests;
import phoenix.web.test_objects.adsbridge.AdsBridgeTests;

public class AdsBridgeTS extends TestSuiteBase
{
	// Tests
	private final AdsBridgeTests bridgeTests = new AdsBridgeTests(phoenix);
	private final RegistrationTests registrationTests = new RegistrationTests(phoenix);
	private final BackendTests backendTests = new BackendTests(phoenix);
	private final FunnelTests funnelTests = new FunnelTests(phoenix);

	@DataProvider
	public Object[][] registrationData()
	{
		return registrationTests.dataProviders.registrationDataMale();
	}

	@DataProvider
	public Object[][] funnelData()
	{
		return funnelTests.dataProviders.funnelData();
	}

	@DataProvider
	public Object[][] sitesData()
	{
		return bridgeTests.dataProviders.sitesData();
	}

	@DataProvider
	public Object[][] ruleOne()
	{
		return bridgeTests.dataProviders.ruleOne();
	}

	@DataProvider
	public Object[][] ruleTwo()
	{
		return bridgeTests.dataProviders.ruleTwo();
	}

	@DataProvider
	public Object[][] ruleThree()
	{
		return bridgeTests.dataProviders.ruleThree();
	}

	@DataProvider
	public Object[][] ruleFour()
	{
		return bridgeTests.dataProviders.ruleFour();
	}

	@DataProvider
	public Object[][] ruleFive()
	{
		return bridgeTests.dataProviders.ruleFive();
	}

	@DataProvider
	public Object[][] ruleSix()
	{
		return bridgeTests.dataProviders.ruleSix();
	}

	@Test(dataProvider = "sitesData", priority = 1, enabled = true)
	public void adsBridgeSetCookiesTest(String p_site)
	{
		bridgeTests.setCookiesTest(p_site);
	}

	@Test(dataProvider = "ruleOne", dependsOnMethods = "adsBridgeSetCookiesTest", priority = 2, enabled = true)
	public void adsBridgeRuleOneTest(String p_jump, String p_site, String p_page)
	{
		bridgeTests.expectedPageTest(p_jump, p_site, p_page, true);
	}

	@Test(dataProvider = "registrationData", dependsOnMethods = "adsBridgeSetCookiesTest", groups = "registration", priority = 3, enabled = true)
	public void registrationTest(String p_userGender, String p_userEmail, String p_userPassword, String p_userBirthDay, String p_userBirthMonth,
			String p_userBirthYear)
	{
		registrationTests.registrationTest(p_userGender, p_userEmail, p_userPassword, p_userBirthDay, p_userBirthMonth, p_userBirthYear);
	}

	@Test(dependsOnMethods = "registrationTest", groups = "registration", priority = 4, enabled = true)
	public void getUserDataTest()
	{
		backendTests.getUserDataTest(testUser().getEmail());
	}

	@Test(dependsOnMethods = "getUserDataTest", groups = "registration", priority = 5, enabled = true)
	public void confirmationMaleTest()
	{
		funnelTests.confirmationTest();
	}

	@Test(dataProvider = "funnelData", dependsOnGroups = "registration", priority = 6, enabled = true)
	public void funnelTest(String p_screenName, LookingFor p_lookingForParams, AboutMe p_aboutMeParams)
	{
		funnelTests.funnelTest(p_screenName, p_lookingForParams, p_aboutMeParams);
	}

	@Test(dependsOnGroups = "registration", priority = 7, enabled = true)
	public void adsBridgePreconditionTest()
	{
		bridgeTests.preconditionTest();
	}

	@Test(dataProvider = "ruleTwo", dependsOnMethods = "adsBridgePreconditionTest", priority = 8, enabled = true)
	public void adsBridgeRuleTwoTest(String p_jump, String p_site, String p_page, PaymentDetails p_details)
	{
		bridgeTests.ruleExecutionTest(p_jump, p_site, p_page, p_details);
	}

	@Test(dataProvider = "ruleThree", dependsOnMethods = "adsBridgeRuleTwoTest", priority = 9, enabled = true)
	public void adsBridgeRuleThreeTest(String p_jump, String p_site, String p_page, PaymentDetails p_details)
	{
		bridgeTests.ruleExecutionTest(p_jump, p_site, p_page, p_details);
	}

	@Test(dataProvider = "ruleFour", dependsOnMethods = "adsBridgeRuleThreeTest", priority = 10, enabled = true)
	public void adsBridgeRuleFourTest(String p_jump, String p_site, String p_page, PaymentDetails p_details)
	{
		bridgeTests.ruleExecutionTest(p_jump, p_site, p_page, p_details);
	}

	@Test(dataProvider = "ruleFive", dependsOnMethods = "adsBridgeRuleFourTest", priority = 11, enabled = true)
	public void adsBridgeRuleFiveTest(String p_jump, String p_site, String p_page, PaymentDetails p_details)
	{
		bridgeTests.ruleExecutionTest(p_jump, p_site, p_page, p_details);
	}

	@Test(dataProvider = "ruleSix", dependsOnMethods = "adsBridgeRuleFiveTest", priority = 12, enabled = true)
	public void adsBridgeRuleSixTest(String p_jump, String p_site, String p_page)
	{
		bridgeTests.expectedPageTest(p_jump, p_site, p_page, false);
	}
}